namespace Beauty.Net.MiniExcel.Core;

/// <summary>
/// MiniExcel服务接口
/// </summary>
public interface IMiniExcelService : IDisposable
{
    void ExportToFile<T>(IEnumerable<T> data, string filePath, string sheetName = "Sheet1") where T : class, new();
    MemoryStream ExportToStream<T>(IEnumerable<T> data, string sheetName = "Sheet1") where T : class, new();
    List<T> ImportFromFile<T>(string filePath, string? sheetName = null, string startCell = "A1") where T : class, new();
    List<T> ImportFromStream<T>(Stream stream, string? sheetName = null, string startCell = "A1") where T : class, new();
    Task ExportToFileAsync<T>(IEnumerable<T> data, string filePath, string sheetName = "Sheet1", CancellationToken cancellationToken = default) where T : class, new();
    Task<List<T>> ImportFromFileAsync<T>(string filePath, string? sheetName = null, string startCell = "A1", CancellationToken cancellationToken = default) where T : class, new();

    // 新增方法
    void ExportByTemplate<T>(string templatePath, string outputPath, T data, CancellationToken cancellationToken = default);
    void ExportWithDataReader(System.Data.IDataReader dataReader, string filePath, string sheetName = "Sheet1");
    IList<string> GetSheetNames(string filePath);
    bool ValidateExcelFormat(string filePath);
}